/**
 * 
 */
package com.aq.actions;

/**
 * @author shl
 *
 */
import java.util.Collection;

import org.apache.commons.lang.StringUtils;

import com.aq.model.AqCase;
import com.aq.service.ICaseService;
import com.aq.service.INewsService;
import com.hs.common.page.PageParam;
import com.hs.common.page.PageUtil;
import com.hs.core.action.AbstractAction;

public class CaseAction extends AbstractAction {
    
    private ICaseService caseService;  
    private AqCase caseObj; 
    
    protected Collection availableItems;
    protected String pageStr;
    protected String content;
    protected PageUtil pageUtil; 
    protected String queryMap;
    protected Long caseid;
    
    public String list() throws Exception {
    	
    	PageParam pageParam = new PageParam(this.getHttpServletRequest(),"listNews.action");
		String hql = " from AqCase where 1=1";
		pageParam.setSearchSql(hql);
		pageUtil = caseService.getCaseList(pageParam);
		availableItems = pageUtil.getPageList();
		pageStr = pageUtil.getPageStr();
//		System.out.println("pageStr:" + pageStr);
        return SUCCESS;         
    }
    
    public String load() throws Exception {
    	String caseid = this.getHttpServletRequest().getParameter("caseid");
    	if(StringUtils.isNotEmpty(caseid)){
    		setCaseid(new Long(caseid));
    		this.caseObj = (AqCase)caseService.findByID(AqCase.class, this.getCaseid());
    		//setContent(this.caseObj.getContent() == null?"":this.caseObj.getContent());
    	} 
    	
        return SUCCESS;
    }
    
    public String save() throws Exception { 
    	 
    	if(null != caseObj){ 
    		caseService.saveObject(caseObj); 
    	}
        return SUCCESS;
    }
    
    public String delete() throws Exception {
       
        return SUCCESS;
    }     
    public Collection getAvailableItems() {
        return availableItems;
    }

	 

	public AqCase getCaseObj() {
		return caseObj;
	}

	public void setCaseObj(AqCase caseObj) {
		this.caseObj = caseObj;
	}

	public String getPageStr() {
		return pageStr;
	}

	public void setPageStr(String pageStr) {
		this.pageStr = pageStr;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public PageUtil getPageUtil() {
		return pageUtil;
	}

	public void setPageUtil(PageUtil pageUtil) {
		this.pageUtil = pageUtil;
	}

	public String getQueryMap() {
		return queryMap;
	}

	public void setQueryMap(String queryMap) {
		this.queryMap = queryMap;
	}

	public Long getCaseid() {
		return caseid;
	}

	public void setCaseid(Long caseid) {
		this.caseid = caseid;
	}

	public void setAvailableItems(Collection availableItems) {
		this.availableItems = availableItems;
	}

	public ICaseService getCaseService() {
		return caseService;
	}

	public void setCaseService(ICaseService caseService) {
		this.caseService = caseService;
	}

  
    
}
